package org.adream.account.entity;

import org.adream.account.util.WeixinUtil;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;


import me.chanjar.weixin.mp.api.WxMpConfigStorage;
import me.chanjar.weixin.mp.api.WxMpInMemoryConfigStorage;
import me.chanjar.weixin.mp.api.WxMpService;
import me.chanjar.weixin.mp.api.WxMpServiceImpl;

@Configuration
public class MainConfig {
	
	 @Bean
	 public WxMpService wxMpService() {
	        WxMpService wxMpService = new WxMpServiceImpl();
	        wxMpService.setWxMpConfigStorage(wxMpConfigStorage());
	        return wxMpService;
	}
	 
	 @Bean
	 public WxMpConfigStorage wxMpConfigStorage(){
	        WxMpInMemoryConfigStorage wxMpConfigStorage = new WxMpInMemoryConfigStorage();
	        wxMpConfigStorage.setAppId(WeixinUtil.WXAPP_APPID);
	        wxMpConfigStorage.setSecret(WeixinUtil.WXAPP_SECRET);
//	        wxMpConfigStorage.setToken(wechatAccountConfig.getToken());
	        return wxMpConfigStorage;
	    }
}
